values.js(optional)
values.js
is configuration of JavaScript logic when datatype is executed.
With predefined variables, user can create their own logic for datatype.
It is optional, it needs to be configured if there is a need to execute service api to get the data.
Expected input/output
- Execution input
- Contains request body data for API execution.
- needs to follow the schema/valuesLogicInput configured in
data.json
.
- Execution output
- output will contain datatype data for further executions.
- e.g. Datatype(Jira JiraUser) -> Output(Jira User)
- needs to follow the schema/data configured in
data.json
.
- output will contain datatype data for further executions.
Example values.js
try {
const response = await $.axios({
method: "get",
url: `https://api.atlassian.com/ex/jira/${service.url}/rest/api/2/user/search?query=&projectIds=${input.data.project.id}`,
headers: {
"Authorization": `Bearer ${service.token}`,
"Content-Type": "application/json"
}
})
const users = response.data
var result = []
users.forEach(user => {
if(user.accountType === 'atlassian'){
result.push({
'label': user.displayName,
'name': user.displayName,
'value': {
'id': user.accountId,
'displayName': user.displayName,
'email': user.emailAddress
}
}
)
}
}
)
return result
} catch (error) {
throw error
}
Helpful?